using System.Reflection;
using System.Utility.System.Utility.Resources;

namespace System.Utility.Data.Validation
{
	public class RequireValidator : Validator
	{
		public RequireValidator(string errorMsg, string text, PropertyInfo propertyInfo) : base(errorMsg, text, propertyInfo)
		{
			if (string.IsNullOrEmpty(errorMsg))
			{
				ErrorMsg = string.Format(DefaultErrorMessages.Required, text);
			}
		}

		protected override bool Validation(object value)
		{
			return value != null;
		}
	}
}